﻿@model IEnumerable<MvcApplication5.Models.News>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<table>
    <tr>
        <th>
            Id
        </th>
        <th>
            Title
        </th>
        <th>
            Image
        </th>
        <th>
            Category
        </th>        
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.NewsId)
        </td>
        <td>                        
            @Html.DisplayFor(modelItem => item.Title)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Image)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Category.Name)
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.NewsId }) |
            @Html.ActionLink("Details", "Details", new { id=item.NewsId }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.NewsId })
        </td>
    </tr>
}

</table>

<p>
    @Html.ActionLink("New Post", "Create")
</p>
